package cn.edu.lingnan.association.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.lingnan.association.dao.ActivityDAO;
import cn.edu.lingnan.association.dao.UserDAO;
import cn.edu.lingnan.association.dto.Activity;
import cn.edu.lingnan.association.dto.User;

/**
 * Servlet implementation class SignupServlet
 */
public class InsertActivityServlet extends HttpServlet {

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException {
	 String mid = req.getParameter("mid");
	 
	 String cid = req.getParameter("cid");
	
	 int cact = Integer.parseInt(req.getParameter("cact"));
	 
	 Activity a = new Activity();
	 ActivityDAO ad = new ActivityDAO();	 
	 a.setmId(mid);
	 a.setcId(cid);
	
	 a.setcAct(cact);
	 int flag = ad.insertinfoActivity(a);	
	 if(flag == 1)
		 resp.sendRedirect(req.getContextPath()+"/admin/findallactivity");
	 else
		 resp.sendRedirect(req.getContextPath()+"/error-404.html");
	}

}
